Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sew): limit go routine spawn for activating delegation #84

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

Lazar955
Copy link
Member

Limit go routines getting spawned and doing extra work.

@Lazar955 Lazar955 linked an issue Oct 18, 2024 that may be closed by this pull request
@Lazar955 Lazar955 requested a review from RafilxTenfen October 18, 2024 11:13
@@ -539,6 +539,10 @@ func (sew *StakingEventWatcher) checkBtcForStakingTx() error {
}

for _, del := range delegations {
if del.ActivationInProgress {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better if we didn't get all the tracked delegations at once, because it could happen that we load the delegations to iterate, after that someone updates the del.ActivationInProgress value and this iterator would not know about it

If we are okay with this scenario the code looks good to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with what you say. Tho I do think there's not a high chance for this to happen. What approach would you recommend, first thing that come to my mind was using Iterators

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, like an iterator would work or a function which gets the next del that is not activated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will create an issue to improve this, not a high priority, worst case is we retry

@Lazar955 Lazar955 mentioned this pull request Oct 23, 2024
@Lazar955 Lazar955 merged commit 7491d8a into main Oct 23, 2024
12 checks passed
@Lazar955 Lazar955 deleted the lazar/fix-bstracker branch October 23, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vigilante bstracker watches already tracked transaction
3 participants